import { http } from '@/utils/http'
import type { BannerItem, CategoryItem, GuessItem, HotItem, PageResult } from '@/types/home'
import type { PageParams } from '@/types/global'

/**
 * 获取首页轮播图
 * 活动 banner 位置，1 代表首页，2 代表商品分类页，默认为 1
 * @param {*} distributionSite
 */
export function getHomeBanner(distributionSite = 1) {
  return http<BannerItem[]>({
    url: '/home/banner',
    method: 'GET',
    data: {
      distributionSite,
    },
  })
}

/**
 * 获取首页分类数据
 * @returns
 */
export function getHomeCategory() {
  return http<CategoryItem[]>({
    url: '/home/category/mutli',
    method: 'GET',
  })
}

/**
 * 获取热门推荐
 * @returns
 */
export function getHomeHot() {
  return http<HotItem[]>({
    url: '/home/hot/mutli',
    method: 'GET',
  })
}

/**
 * 获取猜你喜欢商品列表
 * @returns
 */
export function getHomeGoods(data?: PageParams) {
  return http<PageResult<GuessItem>>({
    url: '/home/goods/guessLike',
    method: 'GET',
    data,
  })
}
